{extend name="base/layer_layout" /}


{block name="body"}
<article class="cl pd-20">
    <form action="{:url('admin/Config/save')}" method="post" class="form form-horizontal" id="form-admin-edit">
        <input type="hidden" name="id" value="{$info.id|default=0}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>配置标识：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="配置标识" id="name" name="name" value="{$info.name|default=''}">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>配置标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="配置标题" name="title" id="title" value="{$info.title|default=''}">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>排序：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="" placeholder="排序" id="sort" name="sort">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>配置类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:180px;">
				<select class="select" name="type">
                    {volist name=":config('config_type_list')" id="vo"}
					<option value="{$key}" {eq name="info.type" value="$key"}selected{/eq} >{$vo}</option>
                    {/volist}
				</select>
				</span>（系统会根据不同类型解析配置值）

            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>配置分组：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:180px;">
				<select class="select" name="group">
                    {volist name=":config('config_group_list')" id="vo"}
					<option value="{$key}" {eq name="info.group" value="$key"}selected{/eq} >{$vo}</option>
                    {/volist}
				</select>
                </span>（配置分组 用于批量设置 不分组则不会显示在系统设置中）


            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">配置值：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="value" cols="" rows="" class="textarea"  placeholder="配置值...1000个字符以内" dragonfly="true" onKeyUp="textarealength(this,1000)">{$info.value|default=''}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/1000</p>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">配置项：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="extra" cols="" rows="" class="textarea"  placeholder="配置项...250个字符以内" dragonfly="true" onKeyUp="textarealength(this,250)">{$info.extra|default=''}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/250</p>
                <p>（如果是枚举型 需要配置该项）</p>
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">配置说明：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="remark" cols="" rows="" class="textarea"  placeholder="配置说明...250个字符以内" dragonfly="true" onKeyUp="textarealength(this,250)">{$info.remark|default=''}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/250</p>
                <p>（配置详细说明）</p>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>是否允许更改	：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="is_allow_change" type="radio" id="hide_1" value="1" {eq name="info.is_allow_change" value="1"}checked{/eq} >
                    <label for="hide_1">是</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="hide_2" value="0" name="is_allow_change" {eq name="info.is_allow_change" value="0"}checked{/eq}>
                    <label for="hide_2">否</label>
                </div>
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>

    </form>
</article>
{/block}

{block name="script"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__EXP_PLUGIN__/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__EXP_PLUGIN__/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__EXP_PLUGIN__/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form-admin-edit").validate({
            rules:{
                name:{
                    required:true
                },
                title:{
                    required:true
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit(function (result) {
                    layer.msg(result.msg);
                    if (result.code == 1) {
                        setTimeout(function () {
                            window.parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.$('.btn-refresh').click();
                            parent.layer.close(index);
                        }, 1500);
                    }
                });
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}